<%= link_to sprintf("Youth %03x", @questionnaire.data_collection.youth.id), :controller => 'youth', :action => 'edit', :id => @questionnaire.data_collection.youth.id %> > 
<%= link_to sprintf("Data collection: %s", @questionnaire.data_collection.data_collection_type.name), :controller => 'data_collection', :action => 'edit', :id => @questionnaire.data_collection.id %> >
Questionnaire: <%= @questionnaire.questionnaire_name.name %>

<h1>Questionnaire: <%= @questionnaire.questionnaire_name.name %></h1>
<%= link_to("Delete this questionnaire", {:action => 'delete', :questionnaire => @questionnaire}, :confirm => "Really delete Questionnaire - and associated events?") %>

<p />

<%= form_tag(:controller => 'questionnaire_event', :action => 'create') %>

<div id="formTable">
  <table>
    <tr>
      <td>Set current status: </td>
      <td><%= collection_select(:questionnaire_event, :questionnaire_event_type_id, QuestionnaireEventType.find(:all), :id, :name) %></td>
    </tr>

    <tr>
      <td>Date: </td>
      <td><%= date_select(:questionnaire_event, :event_date, :include_blank => false, :start_year => 2009, :order => [:day, :month, :year]) %></td>
    </tr>


    <tr>
      <td><label for="questionnaire_event_comment">Comment</label>: </td>
      <td><%= text_field('questionnaire_event', 'comment') %></td>
    </tr>




  </table>
</div>

<%= hidden_field :questionnaire_event, :questionnaire_id, :value => @questionnaire.id %>

<%= submit_tag "Set status" %>




<h2>Questionnaire History</h2>

<div id="resultSet">

  <table>
    <tr>
      <th>Date</th>
      <th>Status</th>
      <th>Comment</th>
    </tr>

    <% @questionnaire.questionnaire_events.each do |event| %>

      <tr class="<%= get_next_result_set_type %>">
        <td><%= link_to '<img src="/images/cross.png" border = 0>', {:controller => 'questionnaire_event', :action => 'delete', :id => event.id}, :confirm => "Delete event: " + event.questionnaire_event_type.name + "?" %><%= event.event_date.strftime("%Y-%m-%d") %></td>
        <td><%= event.questionnaire_event_type.name %></td>
        <td><%= event.comment %></td>
      </tr>
    <% end %>

  </table>
</div>

